function icdCodeImport(obj) {
	$("#file").click();
}
$("#file").change(function(){
	$("#Import").val("导入中");
	var url ="/icd/disease_gaoge_import.do";
	importFile("#file",url,null);
});	

/*
$("#file").change(fileChange);

function fileChange(){
	var file = $("#file").val();
	if(file) {
		var FileExt=file.replace(/.+\./,"");   //正则表达式获取后缀
		
		// 后缀只能是xlsx，其他不处理
		if(FileExt != 'xlsx') {
			alert("请上传xlsx后缀的Excel文件");
			return false;
		}
		
		$.ajaxFileUpload({
			url: '/icd/disease_gaoge_import.do',
			secureuri: false,
			fileElementId: 'file',
			dataType: 'json',
			data: {},
			success: function(res, status) {
				$("#file").after($("#file").clone().val(""));
				$("#file").remove();
				$("#file").change(fileChange);
				if(res.code == '0') {
					alert("导入成功！");
					window.location.href = "/icd/disease_gaoge_list.htm";
				} else {
					if(res.code == '30001') {
						alert(res.desc);
					} else {
						alert(res.data.errMsg);
					}
				}
			},
			error: function (data, status, e) {
				$("#file").after($("#file").clone().val(""));
				$("#file").remove();
				$("#file").change(fileChange);
				alert("导入失败！");
			}
		});
	}
}
*/
function icdCodeExport(obj) {
	if(UTIL.checkButton(obj)) {
		window.location.href="/icd/gaoge_export.htm";
		UTIL.releaseButton(obj);
	}
}

function submitServer(obj) {
	if(confirm("确认要提交吗？")) {
		if(UTIL.checkButton(obj)) {
			API.icdCodeSubmitServer(function(res) {
				if (res.code == '0') {
					alert("提交成功！");
				} else {
					alert("提交失败！");
				}
				UTIL.releaseButton(obj);
			});
		}
	}
}

function changeModifyFlag(obj, param) {
	param = encodeURI(param);
	var modifyFlag = $(obj).get(0).checked ? "1" : "0";
	window.location.href = "/icd/disease_gaoge_list.htm?modifyFlag=" + modifyFlag + "&" + param;
}

function diseaseChange(obj,type){
	var param = {
			id:$(obj).attr("id"),
			diseaseName:$(obj).val(),
			type:type
		};
	API.changeDisease(param,function(res) {
		if (res.code == '0') {
		}else{
			location.reload();
			alert(res.desc);
		}
	});
}

function add(){
	var newGaoge = $("#newGaogeName").val();
	var newDisease = $("#newDiseaseName").val();
	var param = {
			newGaogeName:newGaoge,
			newDiseaseName:newDisease
		};
	API.addGaogeDisease(param,function(res) {
		if (res.code == '0') {
			location.reload();
		}else{
			location.reload();
			alert(res.desc);
		}
	});

}
function deleteDisease(obj){
	var param = {
			id:$(obj).attr("name")
		};
	API.deleteDisease(param,function(res) {
		if (res.code == '0') {
			location.reload();
		}else{
			alert(res.desc);
		}
	});
}
